<template>
	<view class="">
		<s-pull-scroll ref="pullScroll" :pullDown="pullDown" :pullUp="loadData" :back-top="true">
			<view class="item-swiper b-t">
				<view class="item" v-for="(item, index) in dataList" :key="index">
					<view class="item-top row between">
						<view class="item-name">{{item.title}}</view>
						<view class="item-money" v-if="item.type==0">+{{item.count}}</view>
						<view class="item-money" v-else>-{{item.count}}</view>
					</view>
					<view class="row">
						<text class="item-order-num">消费时间：{{item.createDate}}</text>
					</view>
				</view>
			</view>
		</s-pull-scroll>
		<mix-loading v-if="isLoading"></mix-loading>
	</view>
</template>

<script>
export default {
	data() {
		return {
			dataList: []
		};
	},
	onLoad() {
		this.refresh();
	},
	methods: {
		pullDown(pullScroll) {
			setTimeout(() => {
				this.loadData(pullScroll);
			}, 200);
		},
		async loadData(pullScroll) {
			const data = {
				uid:uni.getStorageSync('uid'),
				pageNo:pullScroll.page,
				pageSize:'10'
			};
			const res = await this.$request('integral/record', data, { showLoading: true });
			if (pullScroll.page == 1) this.dataList = [];
			if (res.result == 0) {
				this.dataList = this.dataList.concat(res.data.list);
				pullScroll.endByPage(Math.ceil(res.data.count / 10), res.data.list);
			} else {
				this.$util.msg(res.resultNote);
			}
		}
	}
};
</script>
<style>
	page{
		background: #F6F6F6;
	}
</style>

<style scoped>
.item {
	padding:30upx 20upx;
	margin-bottom:10upx;
	background: #FFFFFF;
}
.item-name {
	font-size: 28upx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #000000;
}
.item-money {
	font-size: 30upx;
	font-family: PingFang SC;
	font-weight: bold;
	color: #000000;
	line-height: 36upx;
}

.item-order-info {
	padding: 20upx;
	border-radius: 20upx;
	background: #ffffff;
}
.item-order-right {
	position: relative;
	padding-left: 20upx;
	height: 118upx;
}
.item-order-title {
	font-size: 28upx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #000000;
	line-height: 36upx;
}
.item-order-num {
	font-size: 24upx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #666666;
	line-height: 40upx;
}
.p-y{
	color: #333333 !important;
}
.p-w{
	color:#6AAE59 !important;
}
</style>
